<div class="maintop">
    当前位置：用户管理
    <a href="javascript:;" action="<?=$basepath?>_add" class="mainFrame button icon-plus">添加用户</a>
    <a href="javascript:;" action="<?=$basepath?>?<?=$this->page_url($page_current,$page_url)?>" id="btn_refresh" class="mainFrame button">刷新</a>
    <? if(ISDEBUG){ ?>
        <a href="javascript:$('.debuginfo').toggle();" class="button">调试信息</a>
    <? } ?>
</div>
<div class="main-search">
    <table width="100%">
        <tbody><tr>
            <td>
                <form action="<?=$basepath?>" id="SearchForm" method="get" target="ajax" dataType="html" onajax="beforeSearchForm" call="searchForm" container="#iframe" isLoad="true">
                    <select name="userlevel" id="userlevel">
                        <option value="">用户等级</option>
                        <? foreach($userLevel as $k=>$v){ ?>
                            <option value="<?=$k?>"><?=$v?></option>
                        <? } ?>
                    </select>
                    <select name="agentlevel" id="agentlevel">
                        <option value="">代理等级</option>
                        <? foreach($agentLevel as $k=>$v){ ?>
                            <option value="<?=$k?>"><?=$v?></option>
                        <? } ?>
                    </select>
                    <select name="usertype" id="usertype">
                        <option value="">会员类型</option>
                        <? foreach($this->usertype as $k=>$v){ ?>
                            <option value="<?=$k?>"><?=$v?></option>
                        <? } ?>
                    </select>
                    <input type="text" id="sKey" name="sKey" class="int" placeholder="搜索关键字">

                    注册IP地址：
                    <input type="text" name="regip" class="int" placeholder="IP地址">

                    注册日期：从
                    <input id="fromTime" name="fromTime" type="text" class='Wdate' style='width:100px;' value="<?=$searchdata['fromTime']?date('Y-m-d',intval(strtotime($searchdata['fromTime']))):''?>" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true})"></input>&nbsp;至
                    <input id="toTime" name="toTime" type="text" class='Wdate' style='width:100px;' value="<?=$searchdata['toTime']?date('Y-m-d',intval(strtotime($searchdata['toTime']))):''?>" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true})"></input>&nbsp;&nbsp;
                    每页：
                    <select id="ps" name="ps">
                        <option value="12" <?php if($this->existsKeyInArray('ps',$searchdata,'N',$this->pagesize) == 12) echo 'selected';?> >12</option>
                        <option value="20" <?php if($this->existsKeyInArray('ps',$searchdata,'N',$this->pagesize) == 20) echo 'selected';?> >20</option>
                        <option value="30" <?php if($this->existsKeyInArray('ps',$searchdata,'N',$this->pagesize) == 30) echo 'selected';?> >30</option>
                        <option value="50" <?php if($this->existsKeyInArray('ps',$searchdata,'N',$this->pagesize) == 50) echo 'selected';?> >50</option>
                        <option value="100" <?php if($this->existsKeyInArray('ps',$searchdata,'N',$this->pagesize) == 100) echo 'selected';?> >100</option>
                    </select>
                    <input type="submit" value="搜索" class="upbutton">
                    <input action="<?=$basepath?>_delete_list" type="button" id="deleteSelectId" value="删除选择" class="upbutton">
                </form>
            </td>
        </tr>
        </tbody>

    </table>
</div>
<div id="mainbody">
    <table width="100%" class="tablist">
        <tr class="trbg"><th width="30"><input id="selectAllid" type="checkbox" value="1" /></th>
            <th>No.</th>
			<th>充</th>
			<th>玩家号码</th>
            <th>自</th>
            <th>玩家昵称</th>
            <th>玩家类型</th>
            <th>帐户余额</th>
            <th>积分余额</th>
            <th>参与金额</th>
            <th>充值</th>
            <th>提现</th>
            <th>注册时间</th>
            <th>注册IP</th>
            <th>最后登录ip</th>
            <th width="60">操作</th>
        </tr>
        <? foreach($datas as $v){ ?>
            <tr<?=($v['isdelete']?' class="delete"':'')?>>
                <td width="30"><input type="checkbox" name="selectValue" value="<?=$v['uid']?>" /></td>
                <td><a href="javascript:;" action="/box/mail_add_pop?touid=<?=$v['uid']?>" class="mainFrame" title="发送站内信"><?=$v['uid']?></a></td>
				<td width="20"><a href="/members/rechargetouser?uno=<?=$v['uno']?>" class="button fa fa-cny" target="ajax" func="loadpage" title="给玩家充值"></a></td>
                <td><a href="javascript:;" action="/box/mail_push_pop?uno=<?=$v['uno']?>&nickname=<?=$v['nickname']?>" class="mainFrame" title="推送信息"><?=$v['uno']?></a></td>
                <td width="20"><a href="/members/autosend_list_add?uid=<?=$v['uid']?>" class="button fa fa-plus" target="ajax" func="loadpage" title="加入到自助发包用户列表"></a></td>
                <td style="text-align:left"><?  if($this->deep_in_array($v['uid'], 'uid', $this->autosenduserlist)){ ?>
                        <i class="trygame">机</i>
                    <? } ?>
                    <?=$v['nickname']?></td>
                <td><?=($v['usertype']==2 ? $agentLevel[$v['agentlevel']].'/'.$this->usertype[$v['usertype']] : $this->usertype[$v['usertype']])?></td>
                <td style="text-align:right"><?=(floatval($v['coin'])==0 ? '' : $v['coin'])?></td>
                <td style="text-align:right"><?=intval($v['score'])?></td>
                <td style="text-align:right"><?=(floatval($v['betcoin'])==0 ? '' : $v['betcoin']) ?></td>
                <td style="text-align:right"><?=(floatval($v['rechargecoin'])==0 ? '' : $v['rechargecoin']) ?></td>
                <td style="text-align:right"><?=(floatval($v['cashcoin'])==0 ? '' : $v['cashcoin']) ?></td>
                <td><?=$this->formatTimes($v['regtimes'])?></td>
                <td><a action="<?=$basepath?>_ip?ip=<?=(long2ip($v['regip'])) ?>" title="查看IP来源" class="mainFrame" href="javascript:;"><?=(long2ip($v['regip'])) ?></td>
                <td><a action="<?=$basepath?>_ip?ip=<?=(long2ip($v['lastip'])) ?>" title="查看IP来源" class="mainFrame" href="javascript:;"><?=(long2ip($v['lastip']))?></td>
                <td>
                    <? if($v['isdelete']){ ?>
                        <a action="<?=$basepath?>_recovery?uid=<?=$v['uid']?>" title="恢复" class="mainFrame button icon-undo" href="javascript:;"></a>
                    <? }else{ ?>
                    <a action="<?=$basepath?>_delete?uid=<?=$v['uid']?>" title="删除" class="mainFrame button icon-trash-2" href="javascript:;"></a>
                    <? } ?>
                    <a title="编辑 - <?=$v['nickname']?>" class="colorbox button icon-edit" href="<?=$basepath?>_edit?uid=<?=$v['uid']?>"></a>
                </td>
            </tr>
        <? } ?>
        <tr><td colspan="5">用户统计</td><td colspan="11"><?
                foreach ($total as $key=>$val){
                    echo $this->usertype[$val['usertype']].'：'.$val['_TOTAL'].'， ';
                }
                ?></td></tr>
    </table>
    <? require VIEW.'/page.view.php' ?>
</div>
<script type="text/javascript">
    function beforeSearchForm(){

    }
    function searchForm(self, _html, data){
        $("#iframe").html(_html);
    }
    $(document).ready(function(){
        <?php
        if(''!=$searchdata['userlevel']){
            echo '$("#userlevel option[value='.$searchdata['userlevel'].']").attr("selected", "selected");';
        }
        if(''!=$searchdata['usertype']){
            echo '$("#usertype option[value='.$searchdata['usertype'].']").attr("selected", "selected");';
        }
        if(''!=$searchdata['agentlevel']){
            echo '$("#agentlevel option[value='.$searchdata['agentlevel'].']").attr("selected", "selected");';
        }
        if(!empty($searchdata['sKey'])){
            echo '$("#sKey").val("'.$searchdata['sKey'].'");';
        }
        ?>
        $(".colorbox").colorbox({ iframe: true,width:"80%",height:"80%" });
    });
</script>
